package com.doge.calcalbum.widgets.viewer

import androidx.fragment.app.FragmentActivity
import com.doge.calcalbum.db.model.Entry
import com.github.iielse.imageviewer.ImageViewerBuilder

/**
 * viewer的自定义初始化方案
 */
object ViewerHelper {
    fun provideImageViewerBuilder(
        context: FragmentActivity,
        pageKey: String,
        clicked: Entry,
        all: List<Entry>
    ): ImageViewerBuilder {
        // viewer 构造的基本元素
        val builder = ImageViewerBuilder(
            context = context,
            initKey = clicked.id.toLong(),
            dataProvider = provideViewerDataProvider { all },
            imageLoader = MyImageLoader(),
            transformer = MyTransformer(pageKey)
        )

        MyViewerCustomizer().process(context, builder, all.size) // 添加自定义业务逻辑和UI处理
        return builder
    }


}

